package com.etc.dao.impl;
import java.sql.ResultSet;
import java.util.ArrayList;
/**
 * @author Amber
 */
import java.util.List;

import com.etc.dao.ThemeDao;
import com.etc.entity.Theme;
import com.etc.util.DBUtil;

public class ThemeDaoImpl implements ThemeDao{

	@Override
	public List<Theme> findAll() {
		List<Theme> list = new ArrayList<Theme>();
		ResultSet rs = DBUtil.query("SELECT theme_id,theme_name FROM theme");
		try {
			while (rs.next()) {
				Integer themeId = rs.getInt("theme_id");
				String themeName = rs.getString("theme_name");
				
				Theme theme = new Theme();
				theme.setThemeId(themeId);
				theme.setThemeName(themeName);
				
				list.add(theme);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return list;
	}

}
